//商品管理接口模块
import request from "@/utils/request"
//引入qs
import Qs from "qs"

//获取商品列表
export const getList_api = (params) => {
    return request({
        method: 'get',
        url: '/goods/list',
        params: params
    })
}

//获取分类
export const getCatelist_api = (params) => {
    return request({
        method: 'get',
        url: '/goods/catelist',
        params: params
    })
}

//修改分类
export const editcate_api = (params) => {
    return request({
        method: 'post',
        url: '/goods/editcate',
        data: Qs.stringify(params), //用node.js,php写需要转换   //必须是data
    });
}

//删除分类
export const delcate_api = (params) => {
    return request({
        method: 'get',
        url: '/goods/delcate',
        params: params
    })
}

//添加分类
export const addcate_api = (data) => {
    return request({
        method: 'post',
        url: '/goods/addcate',
        data: Qs.stringify(data)
    })
}

//查询所有分类名称
export const categories_api = () => {
    return request({
        method: 'get',
        url: '/goods/categories',
    })
}

//添加商品
export const addGoods_api = (data) => {
    return request({
        method: 'post',
        url: '/goods/add',
        data: Qs.stringify(data)
    })
}

//删除商品
export const delGoods_api = (params) => {
    return request({
        method: 'get',
        url: '/goods/del',
        params: params
    })
}

//修改商品
export const editGoods_api = (data) => {
    return request({
        method: 'post',
        url: '/goods/edit',
        data: Qs.stringify(data)
    })
}